package ms.core.gateway.dao;

import java.util.ArrayList;
import java.util.List;

import ms.core.gateway.response.DicConstVO;
import ms.core.tool.StrTool;

public class DicConstDao extends BaseDao{

	public DicConstDao() { super("dic_const"); }

	//to query DicConst for record list with condition
	public List<DicConstVO> getConsts(String code, String name){
		String sql = String.format("select * from %s where 1=1", table);
		List<Object> params = new ArrayList<Object>();
		if (!StrTool.isBlank(code)){
			sql += " and code=?";
			params.add(code);
		}
		if (!StrTool.isBlank(name)){
			sql += " and name=?";
			params.add(name);
		}

		return db.queryForBeans(sql, DicConstVO.class, params);
	}
}
